rm -rf ./quantize_results
mkdir quantize_results

# run quantization
echo "#####################################"
echo "Quantize begin"
echo "Vitis AI 1.1"
echo "#####################################"
vai_q_tensorflow quantize \
  --input_frozen_graph ./frozon_results/UltraNet_4w4a.pb \
  --input_nodes input_layer_input \
  --input_shapes ?,160,320,3 \
  --output_nodes output_layer/BiasAdd \
  --method 1 \
  --weight_bit 4 \
  --activation_bit 4 \
  --input_fn graph_input_fn.calib_input \
  --gpu 0 \
  --calib_iter 500 \

mv ./quantize_results/quantize_eval_model.pb ./quantize_results/quantize_eval_model_4w4a.pb
mv ./quantize_results/deploy_model.pb ./quantize_results/deploy_model_4w4a.pb

vai_q_tensorflow quantize \
  --input_frozen_graph ./frozon_results/UltraNet_float.pb \
  --input_nodes input_layer_input \
  --input_shapes ?,160,320,3 \
  --output_nodes output_layer/BiasAdd \
  --method 1 \
  --weight_bit 8 \
  --activation_bit 8 \
  --input_fn graph_input_fn.calib_input \
  --gpu 0 \
  --calib_iter 500 \

mv ./quantize_results/quantize_eval_model.pb ./quantize_results/quantize_eval_model_float.pb
mv ./quantize_results/deploy_model.pb ./quantize_results/deploy_model_float.pb

echo "#####################################"
echo "QUANTIZATION COMPLETED"
echo "#####################################"

